package tgc.edu.ljc.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class TbClass {
	private Integer id;
	private String name;
	private String manager;
	private List<Student> students=new ArrayList<>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(length=10)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(length=10)
	public String getManager() {
		return manager;
	}
	public void setManager(String manager) {
		this.manager = manager;
	}
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="tbClass")
	public List<Student> getStudents() {
		return students;
	}
	public void setStudents(List<Student> students) {
		this.students = students;
	}
	public TbClass() {
		super();
	}
	
	public TbClass(Integer id) {
		super();
		this.id = id;
	}
	public TbClass(Integer id, String name, String manager) {
		super();
		this.id = id;
		this.name = name;
		this.manager = manager;
	}
	@Override
	public String toString() {
		return "id:"+id+",name:"+name+",manager:"+manager;
	}
	
	
}
